import {BasicColumn, FormSchema} from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '配置名称',
    dataIndex: 'tips',
    width: 250,
    align: 'center',
  },
  {
    title: '配置内容',
    dataIndex: 'value',
    align: 'center',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: 'key',
    component: 'Input',
    colProps: {span: 8},
  },
  {
    field: 'value',
    label: 'value',
    component: 'Input',
    colProps: {span: 8},
  },
];

//新增弹窗form字段
export let formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    required: true,
    defaultValue: 0,
    show: false,
  },
  {
    field: 'key',
    label: '配置key',
    component: 'Input',
    required: true,
  },
  {
    field: 'tips',
    label: '配置名称',
    component: 'Input',
  },
  {
    field: 'component_type',
    label: '配置内容格式',
    component: 'Select',
    required: true,
    // changeEvent:'changeEvent',
    componentProps: ({schema, tableAction, formActionType, formModel}) => {
      return {
        // xxxx props
        options: [
          {
            label: '文本框',
            value: 'Input',
            key: 'Input',
          },
          {
            label: '多行文本框',
            value: 'InputTextArea',
            key: 'InputTextArea',
          },
          {
            label: '数字进步器',
            value: 'InputNumber',
            key: 'InputNumber',
          },
          {
            label: '日期选择器',
            value: 'DatePicker',
            key: 'DatePicker',
          }
        ],
        onChange: (e) => {
          console.log('formModel',formModel)
          console.log('e', e)
          valueRow.component = e;
        }
      };
    }
  },
];
export let valueRow: FormSchema = {
  field: 'value',
  label: '配置内容',
  component: 'Input',
  required: true,
  componentProps:{
    format: 'YYYY-MM-DD HH:mm:ss',
    showTime: "{ format: 'HH:mm:ss' }",
  }
}
formSchema.push(valueRow)

export const componentType: string[] = [
  "Input",
  "InputTextArea",
  "InputNumber",
  "DatePicker",
  "MonthPicker",
  "RangePicker",
  "WeekPicker",
  "TimePicker",
]
